package com.example.department.controller;

import com.example.department.pojo.Emp;
import com.example.department.pojo.Result;
import com.example.department.service.EmpService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    private EmpService empService;
    @Autowired

    public LoginController(EmpService empService) {
        this.empService = empService;
    }

    @PostMapping("login")
    public Result login( @RequestBody Emp emp)
    {
        Emp e=empService.login(emp);
        return e!=null?Result.success():Result.error("错误");
    }

}
